package cn.cl.lock1;

import java.util.concurrent.TimeUnit;

public class Test {
    public static void main(String[] args) {
        for(int i=0;i<2;i++){
            new Thread(()->{
                try {
                    ZkLock lock = new ZkLock();
                    lock.getLock();
                    System.out.println(Thread.currentThread().getName()+"获取到了锁");
                    TimeUnit.SECONDS.sleep(60);
                    lock.unLock();
                    System.out.println(Thread.currentThread().getName()+"释放了锁");
                } catch (Exception e) {
                    e.printStackTrace();
                }

            },"thread--"+i).start();
        }
    }
}
